package com.gdou.teaching.application;

import com.gdou.teaching.service.RecordService;
import com.gdou.teaching.service.impl.RecordServiceImpl;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;

/**
 * 我们自己的初始化代码写在onApplicationEvent里；
 */
public class ApplicationStartup implements ApplicationListener<ContextRefreshedEvent> {

    @Override
    public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
        RecordService bean = contextRefreshedEvent.getApplicationContext().getBean(RecordService.class);
        bean.initAllExperimentCommitNumber();
    }


}
